package com.crk.controller;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.crk.entity.Record;
import com.crk.service.IRecordService;
import com.crk.util.RestResult;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author com.crk
 * @since 2021-03-29
 */
@CrossOrigin
@RestController
@RequestMapping("/record")
public class RecordController {

	@Autowired
	private IRecordService recordService;
	
	
	@RequestMapping("/getRec")
	public RestResult<Record> getRecords(){
		List<Record> list = recordService.list();
		return RestResult.ok(list);
	}
	
	@RequestMapping("/addRec")
	public RestResult<Record> addRecord(Record rec){
		recordService.save(rec);
		return new RestResult<>();
	}
	
}

